<template>
  <div class="about">
    <div>
      <el-row>
        <el-col :span="2">
          <el-button>添加</el-button>
        </el-col>
        <el-col :span="16">
          &nbsp;

        </el-col>
        <el-col :span="4">
          <el-row>
            <el-col :span="19">
              <el-input v-model="input" placeholder="请输入内容"></el-input>
            </el-col>
            <el-col :span="1">
              &nbsp;

            </el-col>
            <el-col :span="4">
              <el-button type="primary">搜索</el-button>
            </el-col>
          </el-row>
        </el-col>
      </el-row>
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="id" label="学生id" width="180">
        </el-table-column>
        <el-table-column prop="number" label="学号" width="180">
        </el-table-column>
        <el-table-column prop="name" label="学生姓名">
        </el-table-column>
        <el-table-column prop="className" label="班级">
        </el-table-column>
        <el-table-column prop="majorName" label="专业">
        </el-table-column>
        <el-table-column prop="sex "  label="性别">
         <template slot-scope="scope">
       {{ scope.row.sex === 1 ? '男' : '女' }}
         </template>
        </el-table-column>
        <el-table-column prop="lastLoginTime" label="上次登录">
        </el-table-column>
        <el-table-column label="操作" width="150">
          <template slot-scope="scope"> <!-- 或者使用 v-slot:default="scope" -->
            <el-button type="success" size="mini">编辑</el-button>
            <el-button type="danger" @click="dele(scope.row.id)" size="mini">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <el-pagination style="margin-top: 24px; text-align: center;" background layout="prev, pager, next" :total="1000">
    </el-pagination>
  </div>
</template>
<script>
import { studentList } from '@/api/index'
export default {
  data() {
    return {
      input: '',
      tableData: [],
    }
  },
  methods: {
    getStudentList() {
      studentList().then(res => {
        console.log(res, '学生管理');
        if (res.code === 0) {
          this.tableData = res.data
        }
      })
    }
    
  },
  mounted() {
    this.getStudentList()
   
  },
 
}

</script>
